﻿using System;
using System.Diagnostics;
using System.IO;
using System.Text;

namespace Z2
{
	internal class LogListener : TraceListener
	{
		private string m_fileName;

		public LogListener()
		{
			this.m_fileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Zelvici2.log");
		}

		public override void Write(string message)
		{
			File.AppendAllText(this.m_fileName, message, Encoding.Unicode);
		}

		public override void WriteLine(string message)
		{
			File.AppendAllText(this.m_fileName, DateTime.Now.ToString() + ": " + message + Environment.NewLine, Encoding.Unicode);
		}

	}
}
